package cn.ctvonline.android.kaopu.base;

import android.app.Activity;
import android.os.Bundle;

import com.tendcloud.tenddata.TCAgent;

public abstract class BaseActivity extends Activity {
    protected abstract String generatePageName();

    private static String pageName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        pageName = generatePageName();
        TCAgent.onPageStart(getApplicationContext(), pageName);
    }

    @Override
    protected void onResume() {
        super.onResume();
        TCAgent.onResume(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        TCAgent.onPause(this);
    }

    @Override
    protected void onDestroy() {
        TCAgent.onPageEnd(getApplicationContext(), pageName);
        super.onDestroy();
    }

    public IncomingHandler getHandler() {
        return new IncomingHandler(this);
    }
}
